var test = 1

$(function () {
  $('#menubtn').click(function(){
    $("#navBar").css({
      backgroundColor:"white",
    })
  })
})

function mHttp() {
  var e_name = $('#e_name').val()
  var e_time = $('#e_time').val()
  var e_job = $('#e_job').val()
  var e_original_work = $('#e_original_work').val()
  var e_question = $('#e_question').val()
  var e_solution = $('#e_solution').val()
  var e_check = $('#e_check').val()
  var url =  host + '/operationeiditor?e_time=' + e_time + '&e_name=' + e_name+ '&e_job=' + e_job + '&e_original_work=' + e_original_work + '&e_question=' + e_question + '&e_solution=' + e_solution  + '&e_check=' + e_check  
  let httpRequest = new XMLHttpRequest();//第一步：创建需要的对象
  httpRequest.open('POST', url, true); //第二步：打开连接/***发送json格式文件必须设置请求头 ；如下 - */
  // httpRequest.open('GET', url, true); //第二步：打开连接/***发送json格式文件必须设置请求头 ；如下 - */
  httpRequest.setRequestHeader("Access-Control-Allow-Credentials", true);//设置请求头 注：post方式必须设置请求头（在建立连接后设置请求头）var obj = { name: 'zhansgan', age: 18 };
  httpRequest.setRequestHeader("Access-Control-Allow-Origin", "*");
  httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
  var data = 'e_time=' + e_time + '&e_name=' + e_name+ '&e_job=' + e_job + '&e_original_work=' + e_original_work + '&e_question=' + e_question + '&e_solution=' + e_solution  + '&e_check=' + e_check
  httpRequest.send(data);//发送请求 将json写入send中
  /**
   * 获取数据后的处理程序
   */
  httpRequest.onreadystatechange = function () {//请求后的回调接口，可将请求成功后要执行的程序写在其中
    if (httpRequest.readyState == 4 && httpRequest.status == 200) {//验证请求是否发送成功
      var json = JSON.parse(httpRequest.responseText);//获取到服务端返回的数据
      console.log(json);
      if(json['message'] == '提交成功'){
        alert('提交成功！')
      }else{
        alert('提交失败！')
      }
  }
  };
}